using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DestroyEffect : MonoBehaviour
{
    RhythmGameController gameController;


    public bool isHitted;
    public bool isLong;
    public float animationTime;



    private void OnEnable()
    {
        gameController = RhythmGameController.Instance;
        Invoke("ReturnToPool", animationTime);
    }

    public void ReturnToPool()
    {
        if(isLong)
        {
            gameObject.SetActive(false);
            gameController.ReturnEffectGoToPool(gameObject, gameController.hitLongNoteEffectObjectPool);
            
        }
        else if (isHitted)
        {
            gameObject.SetActive(false);
            gameController.ReturnEffectGoToPool(gameObject, gameController.hitEffectObjectPool);
            
        }
        else
        {
            gameObject.SetActive(false);
            gameController.ReturnEffectGoToPool(gameObject, gameController.downEffectObjectPool);
        }
    }
}
